.class public final Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;
.super Ljava/lang/Object;
.source "BackgroundUncaughtExceptionHandler.java"

# interfaces
.implements Ljava/lang/Thread$UncaughtExceptionHandler;


# static fields
.field private static final DEBUG_WRAPPER:Lcom/burstly/lib/util/Utils$DebugWrapper; = null

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "BackgroundUncaughtExceptionHandler"


# instance fields
.field private mHeapDumpHandler:Ljava/lang/Thread$UncaughtExceptionHandler;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 35
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 45
    const-string v0, "BackgroundUncaughtExceptionHandler"

    invoke-static {v0}, Lcom/burstly/lib/util/Utils$DebugWrapper;->getDebugger(Ljava/lang/String;)Lcom/burstly/lib/util/Utils$DebugWrapper;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->DEBUG_WRAPPER:Lcom/burstly/lib/util/Utils$DebugWrapper;

    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 55
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 56
    sget-boolean v0, Lcom/burstly/lib/constants/Constants;->IS_DEBUG_MODE:Z

    if-eqz v0, :cond_0

    .line 57
    new-instance v0, Lcom/burstly/lib/exception/HeapFileDumpHandler;

    invoke-direct {v0}, Lcom/burstly/lib/exception/HeapFileDumpHandler;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->mHeapDumpHandler:Ljava/lang/Thread$UncaughtExceptionHandler;

    .line 59
    :cond_0
    return-void
.end method

.method private logException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
    .locals 7
    .parameter "t"
    .parameter "e"

    .prologue
    const/4 v6, 0x0

    .line 77
    sget-object v0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "BackgroundUncaughtExceptionHandler"

    const-string v2, "Unexpected problem on thread {0}: {1}"

    const/4 v3, 0x2

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {p1}, Ljava/lang/Thread;->getName()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v3, v6

    const/4 v4, 0x1

    invoke-virtual {p2}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v5

    aput-object v5, v3, v4

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 78
    sget-object v0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v1, "BackgroundUncaughtExceptionHandler"

    invoke-static {p2}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v2

    new-array v3, v6, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 79
    return-void
.end method


# virtual methods
.method public uncaughtException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
    .locals 1
    .parameter "t"
    .parameter "e"

    .prologue
    .line 63
    sget-object v0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->DEBUG_WRAPPER:Lcom/burstly/lib/util/Utils$DebugWrapper;

    invoke-virtual {v0}, Lcom/burstly/lib/util/Utils$DebugWrapper;->logAll()V

    .line 64
    invoke-direct {p0, p1, p2}, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->logException(Ljava/lang/Thread;Ljava/lang/Throwable;)V

    .line 65
    iget-object v0, p0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->mHeapDumpHandler:Ljava/lang/Thread$UncaughtExceptionHandler;

    if-eqz v0, :cond_0

    .line 66
    iget-object v0, p0, Lcom/burstly/lib/exception/BackgroundUncaughtExceptionHandler;->mHeapDumpHandler:Ljava/lang/Thread$UncaughtExceptionHandler;

    invoke-interface {v0, p1, p2}, Ljava/lang/Thread$UncaughtExceptionHandler;->uncaughtException(Ljava/lang/Thread;Ljava/lang/Throwable;)V

    .line 68
    :cond_0
    return-void
.end method
